<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:doc="livcos.org/ns/doc"
  xmlns:c="livcos.org/ns/cosmos"
  xmlns:f="livcos.org/ns/xslt/function"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:v="livcos.org/ns/view"
  exclude-result-prefixes="v doc c f xhtml">

	<xsl:import href="history.xsl"/>
	<xsl:import href="outline.xsl"/>
	<xsl:import href="image.xsl"/>
	<xsl:import href="list.xsl"/>
	<xsl:import href="table.xsl"/>
	<xsl:import href="embedding.xsl"/>
	<xsl:import href="link.xsl"/>
	<xsl:import href="markup.xsl"/>
	
  <xsl:param name="incl-history" select="'1'"/>

	<xsl:template match="/doc:document | /doc:flyer">
		<html id="{$callerObjId}">
			<xsl:apply-templates select="doc:head"/>
			<xsl:sequence select="xhtml:head"/>
			<xsl:apply-templates select="doc:body"/>
		</html>
	</xsl:template>
	
	<xsl:template match="doc:document/doc:head | doc:flyer/doc:head">
    <v:head>
      <v:title path="head/title"><xsl:value-of select="doc:title" /></v:title>
    	<v:context path="head/context"><xsl:value-of select="doc:context"/></v:context>
    </v:head>
  </xsl:template>
  
	<xsl:template match="doc:document/doc:body | doc:flyer/doc:body">
		<body id="{f:object-id(.)}">
			<v:toc/>
			<xsl:if test="$incl-history = '1'">
				<xsl:apply-templates select="../doc:history"/>
			</xsl:if>
			<xsl:apply-templates select="*"/>
    </body>
  </xsl:template>

</xsl:stylesheet>
